#!/bin/sh

. libtest.sh
. libgit.sh

export LINES=5

first_line_content=\
'2014-03-01 17:26 -0500 Jonas Fonseca      o [master] WIP: Upgrade to 0.4-SNAPSHO
2014-03-01 15:59 -0500 Jonas Fonseca      o Add type parameter for js.Dynamic
2014-01-16 22:51 -0500 Jonas Fonseca      o Move classes under org.scalajs.bench
[main] ee912870202200a0b9cf4fd86ba57243212d341e - commit 1 of 48              6%'

last_line_content=\
'2013-10-14 16:09 -0400 Jonas Fonseca      o Move description of the optimizeJS w
2013-10-14 13:15 -0400 Jonas Fonseca      I Initial import of Tracer benchmark
 
[main] 90286e0752016a6bca30dfa7ca236d1f99345eb8 - commit 48 of 48           100%'

in_work_dir create_repo_from_tgz "$base_dir/files/scala-js-benchmarks.tgz"

test_case main-goto-1 \
	--script='
		:1
	' \
	<<EOF
$first_line_content
EOF

test_case main-goto-max \
	--script='
		:48
	' \
	<<EOF
$last_line_content
EOF

test_case main-goto-max-plus-1 \
	--script='
		:49
	' \
	<<EOF
$first_line_content
EOF

test_case main-goto-max-plus-2 \
	--script='
		:50
	' \
	<<EOF
$first_line_content
EOF

run_test_cases
